<div class="page_basic">
  <h1>Want something featured in <em>Changelog News</em>?</h1>

<%= if !@current_user do %>
  <div class="flash flash--inline flash--error">
    <div class="flash-message"><p>Please <%= link("sign in", to: Routes.sign_in_path(@conn, :new)) %> / <%= link("up", to: Routes.person_path(@conn, :join)) %> to submit news. Your profile is used for attribution and notification.</p></div>
  </div>
<% end %>

<%= if @current_user && !@subscribed do %>
  <div class="flash flash--inline flash--error">
    <div class="flash-message"><p>Only <%= link("Changelog News", to: Routes.podcast_path(@conn, :show, "update")) %> subscribers can submit news. We require this to prevent drive-by submissions & spammers.</p></div>
  </div>
<% end %>

  <div id="guidelines" class="richtext richtext--small">
    <p>Submitting other people's work is encouraged. Submitting your own work is also encouraged.</p>
    <p>Here's a short list of things that we aren't interested in 🙅‍♂️
      <ol style="list-style-type: none;">
        <li>🚫&nbsp;&nbsp;How-to's and tutorials. e.g. - "Configure Nginx on Ubuntu Linux 18.04"</li>
        <li>🚫&nbsp;&nbsp;Commercial products/services. <%= link("Sponsorship", to: ~p"/sponsor/pricing") %> is your path.
        <li>🚫&nbsp;&nbsp;Reader-hostile websites. We consider the entire <%= link("reading experience", to: "https://www.youtube.com/watch?v=7UG8JxTEhAk") %>.
        <li>🚫&nbsp;&nbsp;Podcast episode suggestions. Use <%= link("this form", to: Routes.episode_request_path(@conn, :new)) %> instead.
      </ol>
    </p>
    <p>The golden rule: <mark>if your fellow devs will find it interesting, submit it.</mark> That being said... we get <em>a lot</em> of submissions. Do your best to convince us why something is newsworthy. You'll be notified via email <em>if and when</em> your submission gets published.</p>
    <p>Keep it positive. Keep it hacker. 💚</p>
    <hr/>
    <p>&nbsp;</p>
  </div>


  <%= form_for @changeset, Routes.news_item_path(@conn, :create), fn f -> %>
    <div class="form-element_wrap">
      <div class="form-element <%= PublicHelpers.error_class(f, :url) %>">
        <label>URL<span>*</span></label>
        <%= text_input(f, :url, PublicHelpers.user_required_options(@current_user, placeholder: "https://example.com", type: "url", required: true)) %>
        <%= PublicHelpers.error_message(f, :url) %>
      </div>
    </div>

    <div class="form-element_wrap">
      <div class="form-element <%= PublicHelpers.error_class(f, :headline) %>">
        <label>Title<span>*</span></label>
        <%= text_input(f, :headline, PublicHelpers.user_required_options(@current_user, placeholder: "Project/Article title...", required: true)) %>
        <%= PublicHelpers.error_message(f, :headline) %>
      </div>
    </div>

    <div class="form-element_wrap">
      <div class="form-element <%= PublicHelpers.error_class(f, :story) %>">
        <label>What's interesting about it?</label>
        <%= textarea(f, :story, PublicHelpers.user_required_options(@current_user, placeholder: "Proverbial elevator pitch...")) %>
        <%= PublicHelpers.error_message(f, :story) %>
        <p class="form-element-note">Markdown supported</p>
      </div>
    </div>

    <div class="form-submit">
      <p class="form-submit-toc"></p>
      <div>
        <input type="submit" <%= unless(@current_user && @subscribed, do: "disabled") %>>
        <div class="form_submit_responses"></div>
      </div>
    </div>
  <% end %>

</div>
